import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FileUploadComponent } from '../file-upload/file-upload.component';

@Component({
  selector: 'app-upload-test',
  standalone: true,
  imports: [
    CommonModule,
    FileUploadComponent
  ],
  template: `
    <div class="upload-test-container">
      <h2>文件上传测试</h2>
      <div class="upload-section">
        <app-file-upload
          [maxFileSize]="5 * 1024 * 1024 * 1024"
          [chunkSize]="2 * 1024 * 1024"
          [acceptedFileTypes]="'image/*,application/pdf'"
          (uploadComplete)="onUploadComplete($event)"
        ></app-file-upload>
      </div>
    </div>
  `,
  styles: [`
    .upload-test-container {
      padding: 20px;
      max-width: 800px;
      margin: 0 auto;
    }

    h2 {
      color: #333;
      margin-bottom: 20px;
    }

    .upload-section {
      background-color: #fff;
      border-radius: 8px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      padding: 20px;
    }
  `]
})
export class UploadTestComponent {
  onUploadComplete(fileName: string): void {
    console.log(`文件 ${fileName} 上传完成`);
  }
}